// 自定义从上到下弹出的弹窗
import 'package:flutter/material.dart';

class DrawerTop extends StatefulWidget {
  bool visible = false;
  DrawerTop(this.visible, {super.key});

  @override
  State<DrawerTop> createState() => _DrawerTopState();
}

class _DrawerTopState extends State<DrawerTop> {

  @override
  Widget build(BuildContext context) {
    return AnimatedPositioned(
      duration: const Duration(milliseconds: 260),
      top: widget.visible ? 0 : -200, // 控制弹窗的显示和隐藏位置
      left: 0,
      right: 0,
      curve: Curves.easeInOut,
      child: Container(
        height: 200,
        color: Colors.blue,
        child: const Center(
          child: Text(
            '这是一个弹窗',
            style: TextStyle(color: Colors.white, fontSize: 20),
          ),
        ),
      ),
    );
  }
}